<script type="text/javascript" charset="utf-8" src="../js/editor/ckeditor.js"></script>
<?php
	$type=$_GET['type'];
	$ID=$_GET['ID'];
	$s=null;
	switch($type){
		case 'dm': 
			$s="domain";
			break;
		case 'pm': 
			$s="phanmem";
			break;
		case 'sp': 
			$s="sanpham";
			break;
		case 't2': 
			$s="tintuc";
			break;
		case 'tv': 
			$s="tuvan";
			break;
		case 'w': 
			$s="web";
			break;
		case 'dv': 
			$s="dichvu";
			break;						
	}
	$sql="select * from ".$s." where ".$type."Id=".$ID;
	$res=mysql_query($sql);
	$r=mysql_fetch_array($res);
	$sts=$r[$type.'Status'];
?>
<form name="f" method="post" action="include/articlesProc.php?act=edit&type=<?php echo $type; ?>&ID=<?php echo $ID; ?>">
	<table align="center">
		<tr>
			<td>Tiêu đề</td>
		</tr>
		<tr>
			<td width="728">
				<input  type="text" name="title" style="width:726px;" value="<?php echo $r[$type.'Title']; ?>" />
			</td>
		</tr>
		<?php
		switch($type){
			case 'dm':
				?>
					<tr>
						<td>Loại bài viết:
						<input type='radio' name='status' value='1' <?php if($sts==1) echo "checked"; ?> />Domain
						<input type='radio' name='status' value='2' <?php if($sts==2) echo "checked"; ?> />Hosting
						</td>
					</tr>
			<?php	
			
			break;
			case 'w':
			?>
				<tr>
						<td>
						Loại bài viết:
						<input type='radio' name='status' value='1' <?php if($sts==1) echo "checked"; ?> />TM-DT
						<input type='radio' name='status' value='2' <?php if($sts==2) echo "checked"; ?> />Mua bán
						<input type='radio' name='status' value='3' <?php if($sts==3) echo "checked"; ?> />Doanh nghiệp
						<input type='radio' name='status' value='4' <?php if($sts==4) echo "checked"; ?> />Yêu cầu
						</td>
					</tr>
			<?php		
			break;	
			case 'pm':
			?>	
					<tr>
						<td>Loại bài viết:
						<input type='radio' name='status' value='1' <?php if($sts==1) echo "checked"; ?> />Mobile
						<input type='radio' name='status' value='2' <?php if($sts==2) echo "checked"; ?> />Pc
						</td>
					</tr>
		<?php
				break;			
		}
		?>
		<tr>
			<td>Nội dung</td>
		</tr>
		<tr>
			<td>
				<textarea name="detail" id="editor"><?php echo $r[$type.'Detail']; ?></textarea>
			</td>
		</tr>
		<tr>
			<td align="center">
				<input name="apply" type="submit" onClick="return articles();" value="Chấp nhận" />
				<input type="button" value="Trở lại" onClick="back();">
			</td>
		</tr>	
	</table>
</form>
<script>
	
</script>

<script type="text/javascript" language="javascript">
    CKEDITOR.replace( 'editor',{resize_enabled:false});
</script>  